package com.shy.propagation;

import com.shy.transaction.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW;
import static org.springframework.transaction.annotation.Propagation.SUPPORTS;

@Service
public class StockService {

    @Autowired
    private OrderDao orderDao;

    @Transactional(propagation = SUPPORTS)
    public void subStock() {
        orderDao.insert("扣减库存");
    }

    @Transactional(propagation = REQUIRES_NEW)
    public void logStock() {
        orderDao.insert("日志");

    }
}
